import axios from "axios";
import React, { useEffect, useState } from "react";

const App = () => {
  async function getData() {
    const res =  await axios.get('/api/list');
    console.log(res)
  }

  // 1.响应式变量
  const [count, setCount] = useState(1);

  // 2. 发送请求
  useEffect(() => {
    getData()
  }, [])

  return (
    <div>
      <h1>Hello World</h1>
      <h2>{count}</h2>
      <button onClick={() => setCount(count + 1)}>+1</button>
    </div>
  );
};

export default App;
